#include<iostream>
#include<string>
using namespace std;
class Data 
{
    protected:
		string name ;
	public:
		Data();
		Data (string n);
		void print();
};
Data::Data()
{
	name="none";
}
Data::Data(string n)
{
	name=n;
}
void Data::print()
{
	cout<<"姓名："<<name<<endl;
}
class Teacher: virtual public Data
{
	protected:
		int sal;
	public:
		Teacher ();
		Teacher(string n,int s);
		void print();
} ;
Teacher::Teacher()
{
	name="none";
	sal=0;
}
Teacher::Teacher(string n,int s)
{
	name=n;
	sal=s;
}
void Teacher::print()
{
	Data::print();
	cout<<"工资："<<sal<<endl;
}

class Student: virtual public Data
{
	protected:
		int id;
	public:
		Student ();
		Student(string n,int i);
		void print();	
} ;
Student::Student()
{
	name="none";
	id=0;
}
Student::Student(string n,int i)
{
	name=n;
	id=i;
}

void Student::print()
{
	Data::print();
	cout<<"学号："<<id<<endl;
}
class Postgrad: virtual public Student
{
	protected:
		string  dn;
	public:
		Postgrad();
		Postgrad(string n,int i,string d);
		void input();
		void print();
	
};
Postgrad::Postgrad()
{
	name="none";
	id=0;
	dn="none";
}
Postgrad::Postgrad(string n,int i,string d)
{
	name=n;
	id=i;
	dn=d;
}

void Postgrad::print()
{
	Student::print();
	cout<<"系别："<<dn<<endl;	
}
class Tpost:public Postgrad, public Teacher
{
	public:
		Tpost();
		Tpost(string n , int i ,string d ,int s);
		void print();
};
Tpost::Tpost()
{
	name=" none";
	id=0;
	dn="none";
	sal=0;
}
Tpost::Tpost(string n , int i ,string d ,int s)
{
	name=n;
	id=i;
	dn=d;
	sal=s;
}

void Tpost::print()
{
	Postgrad::print();
	cout<<"工资："<<sal<<endl;
}
int main()
{
	Teacher tea("张三",3000);
	Student stu("张小三",10);
	Postgrad pos("张五",11,"网通系");
	Tpost tpo("张六",12,"网通系",3500);
	cout<<"教师："<<endl;	 
	tea.print();
	cout<<endl;
	cout<<"学生："<<endl;	 
	stu.print();
	cout<<endl;
	cout<<"研究生："<<endl;	 
	pos.print();
	cout<<endl;
	cout<<"在职研究生："<<endl;	 
	tpo.print();
	return 0;
}
